Skip to content

Improve testing and documentation for client firewall marks - #13383

Merged
JosiahWI merged 10 commits into
apache:masterfrom
JosiahWI:feat/fwmark-mask
Jul 15, 2026
Merged

Improve testing and documentation for client firewall marks#13383
JosiahWI merged 10 commits into
apache:masterfrom
JosiahWI:feat/fwmark-mask

Conversation

@JosiahWI

@JosiahWI JosiahWI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

There are APIs for both client and server firewall marks. I am preparing to add overloaded functions to those APIs to allow setting a mark with a mask per my proposal on the dev mailing list.

This patch does not change behavior or add any new functionality. It adds a test and improved documentation for the existing client-side firewall mark API. I will make an analogous PR for the server-side API to keep them consistent; I opted to split the PR to limit scope.

The new test only runs on Linux, and only when the capability needed to set SO_MARK is available.

Note for reviewer: Copilot found that these APIs return TS_SUCCESS even if the OS refuses to let us set SO_MARK (because we have insufficient privileges, for example). I believe this is a bug, and I'm leaving it for future work.

@JosiahWI JosiahWI added this to the 11.0.0 milestone Jul 14, 2026
@JosiahWI JosiahWI self-assigned this Jul 14, 2026
Copilot AI review requested due to automatic review settings July 14, 2026 18:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves validation and documentation of the existing client-side firewall mark API (TSHttpTxnClientPacketMarkSet) in ATS by adding a dedicated AuTest-backed plugin test and clarifying API semantics and platform behavior in both the public header and developer docs.

Changes:

  • Add an AuTest plugin that sets a client packet mark from a request header and echoes the observed SO_MARK value back in the response.
  • Add a Linux-only gold test that runs only when SO_MARK can be set (e.g., with CAP_NET_ADMIN).
  • Expand API documentation in include/ts/ts.h and the developer guide to clarify full-mark replacement semantics, return codes, and non-Linux no-op behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/tools/plugins/CMakeLists.txt Registers the new autest plugin build target.
tests/tools/plugins/client_packet_mark_mask.cc Implements the test plugin that sets and reads back the client socket mark.
tests/gold_tests/pluginTest/client_packet_mark/client_packet_mark_mask.test.py Adds an AuTest that drives the plugin and asserts the observed mark.
include/ts/ts.h Clarifies client packet mark API semantics, platform behavior, and return codes.
doc/developer-guide/api/functions/TSHttpTxnClientPacketMarkSet.en.rst Updates developer-guide documentation to match the clarified API behavior.

Comment thread tests/gold_tests/pluginTest/client_packet_mark/client_packet_mark_mask.test.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 14, 2026 18:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.

Comment thread tests/tools/plugins/CMakeLists.txt Outdated
Comment thread tests/tools/plugins/client_packet_mark.cc
Comment thread tests/tools/plugins/client_packet_mark.cc
Comment thread tests/tools/plugins/client_packet_mark.cc
Comment thread tests/gold_tests/pluginTest/client_packet_mark/client_packet_mark_mask.test.py Outdated
Comment thread include/ts/ts.h
Copilot AI review requested due to automatic review settings July 14, 2026 19:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread include/ts/ts.h
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 14, 2026 19:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread tests/tools/plugins/client_packet_mark.cc
Comment thread include/ts/ts.h
@JosiahWI

Copy link
Copy Markdown
Contributor Author

The new AuTest was skipped in CI. I have no way to test it locally. 😖

* Allow PACKET_MARK in sock_option_flag_in
* Mention `CAP_NET_RAW` in docstring
Copilot AI review requested due to automatic review settings July 14, 2026 20:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread include/ts/ts.h
Copilot AI review requested due to automatic review settings July 14, 2026 20:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread include/ts/ts.h
Comment thread tests/gold_tests/pluginTest/client_packet_mark/client_packet_mark.test.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 14, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread tests/tools/plugins/client_packet_mark.cc
Comment thread include/ts/ts.h
The `PrepareTestPlugin` call already takes care of all that stuff.
Copilot AI review requested due to automatic review settings July 14, 2026 21:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread include/ts/ts.h
Copilot AI review requested due to automatic review settings July 14, 2026 21:30
@JosiahWI

Copy link
Copy Markdown
Contributor Author

I got my OpenSUSE docker development container working and ran the new AuTest. It passes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@ezelkow1
ezelkow1 self-requested a review July 14, 2026 22:03
@JosiahWI
JosiahWI requested a review from bneradt July 14, 2026 22:38
@JosiahWI
JosiahWI merged commit 05c958a into apache:master Jul 15, 2026
15 checks passed
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jul 29, 2026
…3383)

* Improve docs for `TSHttpTxnClientPacketMarkSet`

* Add AuTest for `TSHttpTxnClientPacketMarkSet`

* Make changes requested by Brian Neradt

  Allow PACKET_MARK in sock_option_flag_in
  Mention `CAP_NET_RAW` in docstring

(cherry picked from commit 05c958a)
@cmcfarlen cmcfarlen moved this to Picked v10.2.0 in ATS v10.2.x Jul 29, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.0 Jul 29, 2026
@github-project-automation github-project-automation Bot moved this from Picked v10.2.0 to For v10.2.0 in ATS v10.2.x Jul 29, 2026
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

5 participants